package com.imooc.security.data.pojo.exception;



/**
 * Customized application exception.
 *
 * @author Created By Houce
 */
public class CommonException extends RuntimeException {

    private static final long serialVersionUID = -5430955945096897330L;

    private final String code;

    private String message;

    /**
     * default constructor.
     */
    public CommonException() {

        super(CommonResponseEnum.SYSTEM_EXCEPTION.getMessage());
        this.code = CommonResponseEnum.SYSTEM_EXCEPTION.getCode();
        this.message = CommonResponseEnum.SYSTEM_EXCEPTION.getMessage();

    }

    /**
     * @param message
     *            error message
     */
    public CommonException(final String message) {

        super(message);
        this.code = CommonResponseEnum.SYSTEM_EXCEPTION.getCode();
    }

    /**
     * @param code
     *            error code
     * @param message
     *            error message
     */
    public CommonException(final String code, final String message) {

        super(message);
        this.code = code;
        this.message = message;
    }

    public String getCode() {

        return code;
    }

    @Override
    public String getMessage() {

        return message;
    }

}
